home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmAdd
- Caption = "Add Two Numbers"
- ClientHeight = 1695
- ClientLeft = 3300
- ClientTop = 3060
- ClientWidth = 2775
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 1695
- ScaleWidth = 2775
- Begin VB.PictureBox picResult
- AutoRedraw = -1 'True
- Height = 255
- Left = 120
- ScaleHeight = 195
- ScaleWidth = 2475
- TabIndex = 5
- Top = 1320
- Width = 2535
- End
- Begin VB.CommandButton cmdCompute
- Caption = "Compute Sum"
- Height = 375
- Left = 600
- TabIndex = 4
- Top = 840
- Width = 1575
- End
- Begin VB.TextBox txtSecondNum
- Height = 285
- Left = 1680
- TabIndex = 1
- Top = 480
- Width = 975
- End
- Begin VB.TextBox txtFirstNum
- Height = 285
- Left = 1680
- TabIndex = 0
- Top = 120
- Width = 975
- End
- Begin VB.Label lblSecondNum
- AutoSize = -1 'True
- Caption = "Second Number"
- Height = 195
- Left = 240
- TabIndex = 3
- Top = 480
- Width = 1365
- End
- Begin VB.Label lblFirstNum
- AutoSize = -1 'True
- Caption = "First Number"
- Height = 195
- Left = 480
- TabIndex = 2
- Top = 120
- Width = 1095
- End
- Attribute VB_Name = "frmAdd"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub cmdCompute_Click()
- Dim x As Single, y As Single
- 'Display the sum of the two numbers
- Call GetNumbers(x, y)
- Call Add(x, y)
- End Sub
- Private Sub Add(num1 As Single, num2 As Single)
- Dim sum As Single
- 'Display numbers and their sum
- picResult.Cls
- sum = num1 + num2
- picResult.Print "The sum of"; num1; "and"; num2; "is"; sum
- End Sub
- Private Sub GetNumbers(num1 As Single, num2 As Single)
- 'Record the two numbers in the text boxes
- num1 = Val(txtFirstNum.Text)
- num2 = Val(txtSecondNum.Text)
- End Sub
-